<?php
/*
 * roomsync.php
 * - remote room status update, to synchronize 5th and 6th floor rooms between S1 and S2 
 */
 
if (isset($_GET['dn']) && isset($_GET['st'])) {
	$sqlid = mysql_connect('localhost','root','') or die('could not connect');
	mysql_select_db('shogun1',$sqlid);
	$flr  = $_GET['fr'];
	$newroomid = $_GET['rm'];
	$doorname = $_GET['dn'];
	$status = $_GET['st'];
	$now = date('Y-m-d H:i:s');
	$sql = " update rooms set status=$status 
			where door_name='$doorname'
			";
	mysql_query($sql, $sqlid) or die('could not sync: $sql' . mysql_error());
}

echo '<script lang="javascript">parent.document.location.href="../index.php?f='. $flr .'&room='.$newroomid.'"</script>';
?>